home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / cstdio.arc / SRC.ARC / DOINT.A < prev    next >
Text File  |  1985-10-14  |  1KB  |  73 lines

  1. ;    doint.a - perform interrupt call.
  2. ;    (C) Copyright 1985 Cray Research Inc. - All Rights Reserved.
  3. ;    G. R. Mansfield.  85/08/23.
  4. ;    Ver 1.0-5A14.
  5.  
  6.  
  7.     dseg
  8.     public    _carryf_, _zerof_
  9.     public    _rax_, _rcx_, _rdx_, _rbx_
  10.     public    _rsi_, _rdi_, _res_, _rds_
  11.  
  12. ;    maintain order of these variables.
  13.  
  14. _zerof_:            ; zf
  15.     db    0
  16. _carryf_:            ; cf
  17.     db    0
  18.  
  19. _rax_    dw    0        ; ax
  20. _rcx_    dw    0
  21. _rdx_    dw    0
  22. _rbx_    dw    0
  23. _rsi_    dw    0
  24. _rdi_    dw    0
  25. _res_    dw    -1
  26. _rds_    dw    -1
  27.  
  28.     cseg
  29.     public    _doint_
  30.     public    _dosint_
  31.     
  32. _dosint_:
  33.     mov    bx,sp
  34.     mov    ah,[bx+2]    ; set function number
  35.     mov    byte inta+1,021h
  36.     jmp    int1
  37.  
  38. _doint_:
  39.     mov    bx,sp
  40.     mov    al,[bx+2]    ; set interrupt number
  41.     mov    inta+1,al
  42.     mov    ax,_rax_    ; load registers
  43. int1:    mov    cx,_rcx_
  44.     mov    dx,_rdx_
  45.     mov    bx,_rbx_
  46.     mov    si,_rsi_
  47.     push    es
  48.     les    di,dword _rdi_
  49.     cmp    _rds_,0FFFFh
  50.     je    int2
  51.     mov    ds,_rds_
  52. int2:
  53. inta:    int    0
  54.     push    ds        ; restore ds
  55.     push    ss
  56.     pop    ds
  57.     pop    _rds_
  58.     mov    _rax_,ax    ; store registers
  59.     mov    _rcx_,cx
  60.     mov    _rdx_,dx
  61.     mov    _rbx_,bx
  62.     mov    _rsi_,si
  63.     mov    _rdi_,di
  64.     mov    _res_,es
  65.     pop    es
  66.     lahf            ; carry flag
  67.     mov    al,ah
  68.     rol    al,1        ; zero flag
  69.     and    ax,00101h
  70.     mov    word _zerof_,ax
  71.     cld
  72.     ret
  73.